@page
@{ Layout = "_LayoutHome"; }
@section Styles{
    <style>
        .el-form-item {
            margin-bottom: 0px;
        }

        body,body {
            padding: 0;
            margin: 0;
        }
    </style>
}
<div class="rounded-0 shadow p-3 bg-white sticky-top">
        <div class="fw-bolder text-center">
            题库练习
        </div>
    </div>
    <div class="p-5">
        <div class="row g-5">
             <div class="col">
                    <el-button class="w-100 py-3 btn btn-lg rounded-pill" type="primary" plain v-on:click="btnCreateClick('Create')">
                    <i class="bi bi-fast-forward-circle-fill me-3"></i>自定义模型
                </el-button>
            </div>
            <div class="col">
                <el-button class="w-100 py-3 rounded-pill" type="success" plain v-on:click="btnCreateClick('Collect')">
                    <i class="bi bi-person-hearts me-3"></i>收藏练习（{{ collectTotal }}）
                </el-button>
            </div>
            <div class="col">
                     <el-button class="w-100 py-3 btn btn-lg rounded-pill" type="warning" plain v-on:click="btnCreateClick('Wrong')">
                    <i class="bi bi-backspace-reverse me-3"></i>错题练习（{{ wrongTotal }}）
                </el-button>
            </div>
        </div>
        <div class="mt-3">
            <el-tabs tab-position="top">
     <el-tab-pane label="刷题模型" class="border-start-0">
            <div v-if="total>0">
                <div class="row g-5">
                    <div class="col-6" v-for="(item,index) in list">
                        <div class="card card-border card-hover cursor-pointer rounded-0" v-on:click="btnCreateClick('Group',item.id,item.tmCount)">
                            <div class="card-body">
                                <div class="d-lg-flex">
                                    <div class="mb-3 mb-lg-0">
                                        <?xml version="1.0" encoding="UTF-8"?><svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M40 33V42C40 43.1046 39.1046 44 38 44H31.5" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/><path d="M40 16V6C40 4.89543 39.1046 4 38 4H10C8.89543 4 8 4.89543 8 6V42C8 43.1046 8.89543 44 10 44H16" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 16H30" stroke="#333" stroke-width="1" stroke-linecap="round"/><path d="M23 44L40 23" stroke="#333" stroke-width="1" stroke-linecap="round"/><path d="M16 24H24" stroke="#333" stroke-width="1" stroke-linecap="round"/></svg>
                                    </div>
                                    <div class="w-100 ms-lg-4">
                                        <div class="d-flex justify-content-between mt-1">
                                            <div class="pe-3">
                                                <div class="mb-1 fw-bolder">
                                                    {{ item.title }}
                                                </div>
                                                <div>
                                                    <span class="text-dark fw-medium">
                                                        {{ item.mineTmCount }} / {{ item.tmCount }} 道题
                                                    </span>
                                                </div>
                                            </div>
                                            <div>
                                                <el-button type="warning" icon="el-icon-delete" circle v-on:click.stop="btnDeleteClick(item.id)"></el-button>
                                            </div>
                                        </div>
                                        <div>
                                            <div class="mt-4">
                                                <div class="row g-2">
                                                    <div class="col-12 text-primary">
                                                        <div class="d-flex justify-content-start align-items-start">
                                                            <div>
                                                                <nobr><i class="bi bi-arrow-right-circle"></i><span class="ms-1">题型：</span></nobr>
                                                            </div>
                                                            <div>
                                                                <span class="me-1 mb-1" v-for="txName in item.txNames">{{ txName }}</span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-12 text-warning">
                                                        <div class="d-flex justify-content-start align-items-start">
                                                            <div>
                                                                <nobr><i class="bi bi-arrow-right-circle"></i><span class="ms-1">难度：</span></nobr>
                                                            </div>
                                                            <div>
                                                                <span class="me-1 mb-1" v-for="nd in item.nds">{{ nd }}<i class="el-icon-star-on"></i></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-12 text-success">
                                                        <div class="d-flex justify-content-start align-items-start">
                                                            <div>
                                                                <nobr><i class="bi bi-arrow-right-circle"></i><span class="ms-1">知识点：</span></nobr>
                                                            </div>
                                                            <div>
                                                                <span v-if="item.zsds && item.zsds.length>0">
                                                                    <span class="me-1 mb-1" v-for="zsd in item.zsds">{{ zsd }}</span>
                                                                </span>
                                                                <span v-else>全部知识点</span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="my-5 text-center">
                    <el-button class="border-0 rounded-pill" icon="el-icon-refresh-right" v-if="list.length>0 && list.length<total" v-on:click="btnLoadMoreClick" :loading="loadMoreLoading">加载更多</el-button>
                    <small v-else>没有更多了</small>
                </div>
            </div>
            <div class="pt-10" v-else>
                <el-empty></el-empty>
            </div>
        </el-tab-pane>
        <el-tab-pane label="刷题记录" class="border-end-0">
            <div v-if="logTotal>0">
                <div class="pb-5 text-end d-flex justify-content-between w-100 align-items-center">
                    <el-form v-on:submit.native.prevent :inline="true" :model="logForm">
                        <el-form-item label="">
                            <el-date-picker v-model="logForm.dateFrom"
                                            type="datetime"
                                            value-format="yyyy-MM-dd HH:mm:ss"
                                            placeholder="选择开始日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item label="到">
                            <el-date-picker v-model="logForm.dateTo"
                                            type="datetime"
                                            value-format="yyyy-MM-dd HH:mm:ss"
                                            placeholder="选择结束日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" plain icon="el-icon-search" v-on:click="btnLogSearchClick">查 询</el-button>
                        </el-form-item>
                    </el-form>
                    <div>
                        <el-button type="warning" plain icon="el-icon-delete" v-on:click="btnLogClearClick">清空练习记录</el-button>
                    </div>
                </div>
                <div v-for="(practice,index) in logList" v-on:click="goPracticeResult(practice.id)" style="cursor:pointer;">
                    <el-card class="rounded-0 mb-3 card-hover-bg-title" shadow="hover">
                        <div class="row align-items-center g-3">
                            <div class="col">
                                <div class="mb-3 card-title">
                                    <span>{{ practice.title }}</span>
                                </div>
                                <ul class="list-inline fw-light">
                                    <li class="list-inline-item">
                                        <el-tag>{{ utils.getFriendlyDateTime(practice.createdDate) }}</el-tag>
                                    </li>
                                    <li class="list-inline-item">
                                        共：{{ practice.mineTmCount }}题
                                    </li>
                                    <li class="list-inline-item">
                                        答题：{{ practice.answerCount }}
                                    </li>
                                    <li class="list-inline-item text-success">
                                        正确：{{ practice.rightCount }}
                                    </li>
                                    <li class="list-inline-item text-danger">
                                        错误：{{ practice.answerCount-practice.rightCount }}
                                    </li>
                                </ul>
                            </div>
                            <div class="col-auto" style="width:300px;">
                                <div>
                                    <div class="text-end"><small>正确率:{{ utils.formatPercentFloat(practice.rightCount, practice.answerCount) }}%</small></div>
                                    <div class="progress text-end text-white" aria-valuemin="0" aria-valuemax="100" style="height: 20px;">
                                        <div class="progress-bar progress-bar-striped progress-bar-animated bg-success" :style="'width:'+utils.formatPercentFloat(practice.rightCount, practice.answerCount)+'%'"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-card>
                </div>
                <div class="my-5 text-center">
                    <el-button icon="el-icon-refresh-right" v-if="logList.length>0 && logList.length<logTotal" v-on:click="btnLogLoadMoreClick" :loading="logLoadMoreLoading">加载更多</el-button>
                    <small v-else>没有更多了</small>
                </div>
            </div>
            <div class="pt-10" v-else>
                <el-empty></el-empty>
            </div>
        </el-tab-pane>
  </el-tabs>
        </div>
    </div>
<div>
</div>
@section Scripts{
    <script src="/sitefiles/assets/js/home/exam/examPractice.js" type="text/javascript"></script>
}